﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using QMERP.Domain.Entities;

namespace QMERP.Infrastructure.EFCore.Mappings
{
    public class SerialNumberMapping : IEntityTypeConfiguration<SerialNumber>
    {
        public void Configure(EntityTypeBuilder<SerialNumber> builder)
        {
            builder.HasQueryFilter(x => x.IsEnable);
            builder.Property(x => x.Type).HasMaxLength(50);
            builder.Property(x => x.Number);
            builder.Property(x => x.Prefix).HasMaxLength(20);
            builder.Property(x => x.YearNumber);

            builder.HasIndex(x => x.Id);
            builder.HasIndex(x => x.Type);
            builder.HasIndex(x => x.Number);
        }
    }
}
